<template>
<div class="cite-container ">
  <div class="cite-left">
    <p class="title">组件源</p>
    <div  class="pad-all-10">{{curWidget.name}}</div>
  </div>
  <div class="cite-right">
    <p class="title">关联引用组件</p>
    <div class="cite-box">
    <div v-for="(item,index) in relatedComponents" :key="index" class="list" @click="jumpComponents(item.id)"> {{item.name}}</div>
    </div>
  </div>
  <div class="cite-right">
    <p class="title">关联真值反馈</p>
    <div class="cite-box">
    <div v-for="(item,index) in relatedLogic" :key="index" class="list"  @click="jumpLogic(item.id)"> {{item.name}}</div>
    </div>
  </div>
</div>
</template>

<script>
  export default {
    name: "CiteList",
    props:{
      curWidget: {
        type: Object,
        default: () => {
          return {};
        }
      },
      relatedComponents:{
        type: Array,
        default: []
      },
      relatedLogic:{
        type: Array,
        default: []
      },
    },
    methods:{
      jumpComponents(id){
        this.$emit('jumpComponents',id)
      },
      jumpLogic(id){
        this.$emit('jumpLogic',id)
      },
    }
  }
</script>

<style scoped lang="less">
.cite-container {
  width: 100%;
 height: 400px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  border: 1px solid #eee;

  .title {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    margin: 0;
    font-weight: bold;
  }

  .cite-left {
    width: 150px;
    height: 100%;
    text-align: center;
    align-self: stretch;
  }

  .cite-right {
    flex: 1;
    height: 100%;
    text-align: center;
    border-left: 1px solid #eee;
    align-self: stretch;
  }
  .list{
    padding: 6px 0 ;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    &:hover{
      color: #2d69e0;
    }
  }
  .cite-box{
    width: 100%;
    height:360px ;
    overflow: auto;
  }
}
</style>
